Python version discrepancies when running setup.py in pyenv - Stack Overflow

I'm trying to write a setup.py script for a Python project. I want to install this project into a

I'm trying to write a setup.py script for a Python project. I want to install this project into a pyenv virtualenv. So using pyenv 2.4.18 I have tried the following:

pyenv virtualenv 3.12.7 my_env
pyenv local my_env
pip install --upgrade pip
pip install numpy
python setup.py install

setup.py internally calls CMake which builds a Python extension that needs the NumPy development headers, I point CMake to Python using f"-DPython3_EXECUTABLE={sys.executable}" which in this case evaluates to ~/.pyenv/versions/my_env/bin/python3 and everything works smoothly

BUT if I install try to install using pip install ., sys.executable instead evaluates to ~/.pyenv/versions/3.12.7/envs/my_env/bin/python and CMake fails with:

Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found version "3.12.7")

That is absolutely crazy to me since BOTH of those python versions are symbolic links to the same /Users/timonicolai/.pyenv/versions/3.12.7/bin/python. Why can CMake resolve the NumPy dependency in one case but not the other and how do I fix installation via pip?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742400127a4436745.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信