I'm using macOS Big Sur 11.0.1.
I'm setting up a virtual env
$python3 -m venv $my_workdir)/.virtualenv
but getting this error at building wheel
package:
building '_openssl' extension
creating build/temp.macosx-10.14.6-x86_64-3.8/build
creating build/temp.macosx-10.14.6-x86_64-3.8/build/temp.macosx-10.14.6-x86_64-3.8
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I/usr/local/opt/gettext/include -I/Users/engontang/devspace/energisme/terraform/tfwrapper-infra-pda/.wrapper/.virtualenv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c build/temp.macosx-10.14.6-x86_64-3.8/_openssl.c -o build/temp.macosx-10.14.6-x86_64-3.8/build/temp.macosx-10.14.6-x86_64-3.8/_openssl.o -Wconversion -Wno-error=sign-conversion
build/temp.macosx-10.14.6-x86_64-3.8/_openssl.c:575:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cryptography
Building wheel for pynacl (PEP 517) ... /
As wheel
is prebuilt with pip
I thought it could be a pip
upgrade issue, so I checked my pip
version:
$pip --version
pip 20.2b1 from /Library/Python/2.7/site-packages/pip-20.2b1-py2.7.egg/pip (python 2.7)
I don't understand why python 2.7
is still mentionned above while my default python version is:
$python -V
Python 3.8.2
Trying however to upgragde pip results in this:
$pip install --upgrade pip --user
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
Using cached pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
WARNING: The scripts pip, pip2 and pip2.7 are installed in '/Users/engontang/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.2.4
Using pip3
command gives the same result. You can see the DEPRECATION: Python 2.7
message above, and also pip
still showing up the same version rather than 20.2.4
:
$pip --version
pip 20.2b1 from /Library/Python/2.7/site-packages/pip-20.2b1-py2.7.egg/pip (python 2.7)
And my virtualenv
setup still lead to the same above error.
Can one here say why pip
is still looking at python 2.7
site packages, and what could be the problemm with wheel
package build?
Setting compilation Flags helped solving the openssl
for wheel
issue:
export CPPFLAGS=-I/usr/local/opt/openssl/include
export LDFLAGS=-L/usr/local/opt/openssl/lib
But still don't understand the above described pip
behavior.
I agree with Luca
brew install python
ls -l /usr/local/bin/python
ln -s -f /usr/local/bin/python3.7 /usr/local/bin/python
python --version
And if you don't already have Homebrew installed on your mac, you can find the instructions here: https://docs.brew.sh/Installation
For devices using Apple Silicon you may try this (as default homebrew bin directory differs)
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
You can view the command by yourself entering
brew info openssl
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.